import pygame, unittest

#Todo: Move this class out to a model
class Enemy(pygame.Surface):
    def __init__(self, w = 4, h = 4):
        pygame.Surface.__init__(self,(w,h))
        self.fill(pygame.Color('0xff0000'))
        self.pos = 0
        self.size = self.width,self.height = self.get_width(), self.get_height()
        self.rect = self.get_rect()

    def xy(self):
        return (self.rect.x,self.rect.y)

    def move(self, to):
        self.rect = self.rect.move(to)   


class EnemyTestCase(unittest.TestCase):
    def testCreate(self):  ## test method names begin 'test*'
        enemy = Enemy(10,10)
        self.assertEquals(0,enemy.pos)
        self.assertEquals((10,10), enemy.size)
        self.assertEquals(((0,0),(10,10)), enemy.rect)

    def testMove(self):
        enemy = Enemy()
        self.assertEquals((0,0), enemy.xy())
        enemy.move((10,10))
        self.assertEquals((10,10), enemy.xy())

if __name__ == '__main__':
    unittest.main()
